﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UtilZ.Dotnet.Ex.Base;

namespace ConAppCore.Test
{
    internal class TestEnvironmentEx
    {
        public static void Test()
        {
            //var list = EnvironmentEx.GetEnvPaths();
            //string filePath = EnvironmentEx.GetFilePathFromEnvPath("python.exe");

            MemoryInfo memoryInfo = EnvironmentEx.GetHostMemoryInfo();
            StringBuilder sb = new StringBuilder();


            //sb.Append("当前内存使用率:");
            //sb.AppendLine(memoryInfo.ToString());

            sb.Append("总计物理内存大小:");
            sb.AppendLine(UnitConverter.ByteToMB(memoryInfo.TotalPhys).ToString());

            sb.Append("可用物理内存大小:");
            sb.Append(UnitConverter.ByteToMB(memoryInfo.AvailPhys).ToString());
            sb.AppendLine("MB");

            sb.Append("总计交换文件大小:");
            sb.Append(UnitConverter.ByteToMB(memoryInfo.TotalSwapFile).ToString());
            sb.AppendLine("MB");

            sb.Append("总计交换文件大小:");
            sb.Append(UnitConverter.ByteToMB(memoryInfo.AvailSwapFile).ToString());
            sb.AppendLine("MB");

            //sb.Append("总计虚拟内存大小:");
            //sb.Append(UnitConverter.ByteToMB(memoryStatusInfo.ullTotalVirtual).ToString());
            //sb.AppendLine("MB");

            //sb.Append("可用虚拟内存大小:");
            //sb.Append(UnitConverter.ByteToMB(memoryStatusInfo.ullAvailVirtual).ToString());
            //sb.AppendLine("MB");

            //sb.Append("保留:");
            //sb.AppendLine(memoryStatusInfo.ullAvailExtendedVirtual.ToString());

            string str = sb.ToString();
            Console.WriteLine(str);


            //StringBuilder sb = new StringBuilder();

            //sb.Append("当前结构体大小:");
            //sb.AppendLine(memoryStatusInfo.dwLength.ToString());

            //sb.Append("当前内存使用率:");
            //sb.AppendLine(memoryStatusInfo.dwMemoryLoad.ToString());

            //sb.Append("总计物理内存大小:");
            //sb.AppendLine(UnitConverter.ByteToMB(memoryStatusInfo.ullTotalPhys).ToString());

            //sb.Append("可用物理内存大小:");
            //sb.Append(UnitConverter.ByteToMB(memoryStatusInfo.ullAvailPhys).ToString());
            //sb.AppendLine("MB");

            //sb.Append("总计交换文件大小:");
            //sb.Append(UnitConverter.ByteToMB(memoryStatusInfo.ullTotalPageFile).ToString());
            //sb.AppendLine("MB");

            //sb.Append("总计交换文件大小:");
            //sb.Append(UnitConverter.ByteToMB(memoryStatusInfo.ullAvailPageFile).ToString());
            //sb.AppendLine("MB");

            //sb.Append("总计虚拟内存大小:");
            //sb.Append(UnitConverter.ByteToMB(memoryStatusInfo.ullTotalVirtual).ToString());
            //sb.AppendLine("MB");

            //sb.Append("可用虚拟内存大小:");
            //sb.Append(UnitConverter.ByteToMB(memoryStatusInfo.ullAvailVirtual).ToString());
            //sb.AppendLine("MB");

            //sb.Append("保留:");
            //sb.AppendLine(memoryStatusInfo.ullAvailExtendedVirtual.ToString());

            //string str = sb.ToString();
        }
    }
}
